﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Spanner;

namespace SpannerWebSite
{
    internal partial class RefMaths : Reference
    {
        internal static SpannerChapter TheChapter;

        static RefMaths()
        {
            var sections = new List<SpannerSection> { };
            var initActs = new List<Act> { };

            Action<string, string, Html> addSection = (title, id, html) =>
            {
                sections.Add(Section(Esc(title), id, html));
            };

            addSection("Abs", "Abs", P(Code("Abs(x)"), " denotes the JavaScript ",
                Code("Math.abs(x)"), "."));

            addSection("Acos", "Acos", P(Code("Acos(x)"), " denotes the JavaScript ",
                Code("Math.acos(x)"), "."));

            addSection("Asin", "Asin", P(Code("Asin(x)"), " denotes the JavaScript ",
                Code("Math.asin(x)"), "."));

            addSection("Atan", "Atan", P(Code("Atan(x)"), " denotes the JavaScript ",
                Code("Math.atan(x)"), "."));

            addSection("Atan2", "Atan", P(Code("Atan2(x, y)"), " denotes the JavaScript ",
                Code("Math.atan2(x, y)"), "."));

            addSection("Ceil", "Ceil", P(Code("Ceil(x)"), " denotes the JavaScript ",
                Code("Math.ceil(x)"), "."));

            addSection("Cos", "Cos", P(Code("Cos(x)"), " denotes the JavaScript ",
                Code("Math.cos(x)"), "."));

            addSection("E", "E", P(Code("E()"), " denotes the JavaScript ",
                Code("Math.E"), "."));

            addSection("Exp", "Exp", P(Code("Exp(x)"), " denotes the JavaScript ",
                Code("Math.exp(x)"), "."));

            addSection("Floor", "Floor", P(Code("Floor(x)"), " denotes the JavaScript ",
                Code("Math.floor(x)"), "."));

            addSection("Ln10", "Ln10", P(Code("Ln10(x)"), " denotes the JavaScript ",
                Code("Math.ln10(x)"), "."));

            addSection("Ln2", "Ln2", P(Code("Ln2(x)"), " denotes the JavaScript ",
                Code("Math.ln2(x)"), "."));

            addSection("Log10E", "Log10E", P(Code("Log10E(x)"), " denotes the JavaScript ",
                Code("Math.LN10(x)"), "."));

            addSection("Log2E", "Log2E", P(Code("Log2E(x)"), " denotes the JavaScript ",
                Code("Math.LN2(x)"), "."));

            addSection("Log", "Log", P(Code("Log(x)"), " denotes the JavaScript ",
                Code("Math.log(x)"), "."));

            addSection("MaxDouble", "MaxDouble", P(Code("MaxDouble(xs)"), " denotes the JavaScript ",
                Code("Math.max.apply(null, xs)"), "."));

            addSection("MaxDouble", "MaxDouble", P(Code("MaxDouble(x1, x2, ..., xN)"), " denotes the JavaScript ",
                Code("Math.max(x1, x2, ..., xN)"), "."));

            addSection("MaxInt", "MaxInt", P(Code("MaxInt(xs)"), " denotes the JavaScript ",
                Code("Math.max.apply(null, xs)"), "."));

            addSection("MaxDouble", "MaxDouble", P(Code("MaxDouble(x1, x2, ..., xN)"), " denotes the JavaScript ",
                Code("Math.max(x1, x2, ..., xN)"), "."));

            addSection("MinDouble", "MinDouble", P(Code("MinDouble(xs)"), " denotes the JavaScript ",
                Code("Math.max.apply(null, xs)"), "."));

            addSection("MinDouble", "MinDouble", P(Code("MinDouble(x1, x2, ..., xN)"), " denotes the JavaScript ",
                Code("Math.max(x1, x2, ..., xN)"), "."));

            addSection("MinInt", "MinInt", P(Code("MinInt(xs)"), " denotes the JavaScript ",
                Code("Math.max.apply(null, xs)"), "."));

            addSection("MinDouble", "MinDouble", P(Code("MinDouble(x1, x2, ..., xN)"), " denotes the JavaScript ",
                Code("Math.max(x1, x2, ..., xN)"), "."));

            addSection("Pi", "Pi", P(Code("Pi()"), " denotes the JavaScript ",
                Code("Math.PI"), "."));

            addSection("Pow", "Pow", P(Code("Pow(x, y)"), " denotes the JavaScript ",
                Code("Math.pow(x, y)"), "."));

            addSection("Random", "Random", P(Code("Random()"), " denotes the JavaScript ",
                Code("Math.random()"), "."));

            addSection("Sin", "Sin", P(Code("Sin(x)"), " denotes the JavaScript ",
                Code("Math.sin(x)"), "."));

            addSection("Sqrt", "Sqrt", P(Code("Sqrt(x)"), " denotes the JavaScript ",
                Code("Math.sqrt(x)"), "."));

            addSection("Sqrt1_2", "Sqrt1_2", P(Code("Sqrt1_2()"), " denotes the JavaScript ",
                Code("Math.SQRT1_2"), "."));

            addSection("Sqrt2", "Sqrt2", P(Code("Sqrt2()"), " denotes the JavaScript ",
                Code("Math.SQRT2"), "."));

            addSection("Tan", "Tan", P(Code("Tan(x)"), " denotes the JavaScript ",
                Code("Math.tan(x)"), "."));

            TheChapter = CommonUI.Chapter("Reference - Maths", "RefMaths", sections, initActs);
        }
    }
}
